# if 缩进代表层级
cars = ['audi', 'bmw', 'subaru', 'toyota']
for car in cars: 
    if car == 'bmw':
        # 全大写
        print(car.upper())
    else:
        # 首字母大写
        print(car.title())
print("\r")

# 多个条件，用and
age_0 = 22
age_1 = 18
res = (age_0 >= 21 and age_1 >= 21)
print (res)
print("\r")

# 多个条件，用or

# 判断元素是否在列表中，in
requested_toppings = ['mushrooms', 'onions', 'pineapple']
res = 'mushrooms' in requested_toppings
print(res)

# 判断元素不在列表中，not in
banned_users = ['andrew', 'carolina', 'david']
user = 'marie'

if user not in banned_users:
    print(user.title() + ", you can post a response if you wish.")

# if-elif-else
age = 16
if age < 4:
    price = 0
elif age < 18:
    price = 5
elif age < 65:
    price = 10
else:
    price = 15
print(price)

# 确定列表不是空的
requested_toppings = []

# 判断列表是不是空
if requested_toppings:
    for requested_topping in requested_toppings:
        print("Adding " + requested_topping + ".")
        print("\nFinished making your pizza!")
# False 列表为空
else:
    print("Are you sure you want a plain pizza?")

